﻿@model SettingItem
@Html.Extra()
@{
    Layout = "~/Views/Shared/OA/_Form.cshtml";

    if (!string.IsNullOrEmpty(Request["Type"]))
    {
        Model.Type = ConvertHelper.ToInt32(Request["Type"]);
    }
}
@section Toolbar
{
    @Html.MyNet().Button(new ButtonOptions { Text = "保存", Click = "save" })
    @Html.MyNet().Button(new ButtonOptions { Text = "返回", Click = "back" })
}
@section Main
{
    @Html.HiddenFor(model => model.Id)
    @Html.HiddenFor(model => model.SettingId)
    @Html.HiddenFor(model => model.Type)
    @Html.Partial("_FormFor" + ((SettingItemType)Model.Type).ToString())
}
<script>

    function save()
    {
        var form = $("form");
        if (!form.valid()) return;

        $.ajax
        ({
            url: form.attr("action"),
            data: form.serialize(),
            type: "post",
            error: disposeError,
            success: function (result)
            {
                if (disposeException(result)) return;
                back(true);
            }
        });
    }
  
</script>
